<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8">
  <title>留言列表</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" th:href="@{/layui/dist/css/layui.css}"  media="all">
    <link rel="stylesheet" type="text/css" th:href="@{/css/bootstrap.min.css}">
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body class="layui-view-body">
<div class="layui-content">
    <div class="layui-page-header">
        <div class="pagewrap">
            <div class="pagewrap" style="height: 80px;">
                <div style="margin-left: 50px;margin-top: 30px;">
                    <font size="6">留言管理</font>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-card">
            <div class="layui-card-body">
                <div class="form-box">
                    <form th:action="@{/messageList}" method="post">
                        <div class="layui-form layui-form-item">
                            <div class="layui-inline">
                                <!--<div class="layui-form-mid">用户编号:</div>-->
                                <!--<div class="layui-input-inline" style="width: 120px;">-->
                                    <!--<input type="text" autocomplete="off" class="layui-input" name="userNo">-->
                                <!--</div>-->


                                <div class="layui-form-mid">状态:</div>
                                <div class="layui-input-inline" style="width: 100px;">
                                    <select name="messageState">
                                        <option value=""></option>
                                        <option th:selected="${messageState == '1'}" value="1">已阅读</option>
                                        <option th:selected="${messageState == '2'}" value="2">未阅读</option>
                                    </select>
                                </div>
                                <button class="layui-btn layui-btn-blue">查询</button>
                                <!--<button class="layui-btn layui-btn-primary">重置</button>-->
                            </div>
                        </div>
                    </form>

                    <table class="layui-table">
                        <colgroup>
                            <col width="150">
                            <col width="200">
                            <col>
                        </colgroup>
                        <thead>
                        <tr>
                            <th hidden="hidden">id</th>
                            <!--<th>用户头像</th>-->
                            <th>用户编号</th>
                            <th>留言编号</th>
                            <th>用户昵称</th>
                            <th>用户身份</th>
                            <th>留言时间</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr th:each="message:${messageList}" >
                            <td hidden="hidden" th:text="${message.id}" th:name="id">1</td>
                            <!--<td th:text="${message.image}">用户头像</td>-->
                            <td th:text="${message.userNo}">用户编号</td>
                            <td th:text="${message.messageNo}">留言编号</td>
                            <td th:text="${message.nickName}">用户昵称</td>
                            <td th:text="${message.type==1?'需求方':'开发方'}">用户身份</td>
                            <td th:text="${#dates.format(message.createTime, 'yyyy-MM-dd HH:mm:ss')}">留言时间</td>
                            <td th:text="${message.messageState == '1' ? '已阅读':'未阅读'}">状态</td>

                            <td>
                                <button class="layui-btn layui-btn-sm" type="button" th:onclick="'showMessageDetail(' + ${message.id} + ')'">查看留言</button>
                                <!--<a class="layui-btn layui-btn-sm"style="background-color:orange" th:href="@{/enable(id=${sysUser.id})}">启用</a>-->
                                <!--<a class="layui-btn layui-btn-sm" style="background-color: red" th:href="@{/disable(id=${sysUser.id})}">禁用</a>-->
                                <!--<button class="layui-btn layui-btn-sm layui-btn-danger" th:onclick="">启用</button>-->
                                <!--<button class="layui-btn layui-btn-sm layui-btn-danger">禁用</button>-->
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <!--分页导航-->
                    <div class="pagination center pagination-large pt-20" style="margin-left: 30%">
                        <div class="row text-center">
                            <div class="col-md-12">
                                <ul class="pagination">
                                    <li><a th:class="${currentPage eq 1 ? 'btn disabled' : '' }" href="javascript:;" th:href="@{/messageList(page=1,messageState=${messageState})}">首页</a></li>
                                    <li><a th:class="${currentPage eq 1 ? 'btn disabled' : '' }" href="javascript:void(0);" th:href="@{/messageList(page=${currentPage}-1,messageState=${messageState})}">&laquo;</a></li>

                                    <li th:class="${page eq currentPage} ? 'active' : ''" th:each="page:${#numbers.sequence(1,totalPage)}">
                                        <a href="javascript:void(0);" th:href="@{/messageList(page=${page},messageState=${messageState})}" th:text="${page}">1</a>
                                    </li>

                                    <li><a th:class="${currentPage eq totalPage ? 'btn disabled' : '' }" href="javascript:void(0);" th:href="@{/messageList(page=${currentPage}+1,messageState=${messageState})}">&raquo;</a></li>
                                    <li><a th:class="${currentPage eq totalPage ? 'btn disabled' : '' }" href="#" th:href="@{/messageList(page=${totalPage},messageState=${messageState})}" style="border: 1px solid #ddd;">尾页</a></li>
                                    <li><a style="border: 0px;margin-left: 0px;">当前页<span th:text="${currentPage}"></span>/<span th:text="${totalPage}"></span>总页</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script th:src="@{/layui/dist/layui.all.js}" charset="utf-8"></script>
<script th:src="@{/js/jquery.min.js}" charset="utf-8"></script>
    <script>
        //弹出层 显示用户详细信息
        function showMessageDetail(id){
            layer.open({
                //layer提供了5种层类型。可传入的值有：0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）
                type:2,
                title:"回复信息",
                area: ['80%','80%','left:126px'],
                content:'/code/readMessage?id=' + id
            });

        }
    </script>
</body>
</html>
